Repository navigation
Conversation
- CartItems: a first-class collection absorbing the find/map/filter/reduce that used to be duplicated three times in Cart, replacing getItemsCopy() - Cart now takes item ids (increaseQuantity, decreaseQuantity, removeItem), so the UI no longer pulls a Product back out of a CartItem just to hand it back to Cart. Added remainingForFreeShipping(), the Money arithmetic that used to live in JSX - dropped CartItem.getProduct() (the source of that Demeter chain) and the dead getPrice(); renamed the rest to id()/name()/image()/quantity() to match the rest of the domain's naming - quantity clamping moved off CartItem onto Quantity (clampBetween, isAtLeast, isAtMost), Money got isAtLeast/isZero so policies stop comparing raw .toAmount() values - Skill's SkillValue and Product's KnowledgeProfile were the same concept with two vocabularies (intermediate vs adventurer) bridged by a ProductCardLogic shim. Unified on one type, deleted the shim - GoldSilverCopperFormatter split into GoldSilverCopperAmount (conversion) and GoldSilverCopperFormatter (presentation), both got the specs they never had - Stats.asObject() dissolved the value object into a plain record the UI had to re-derive labels from (and rendered "ManaBoost: 0" rows). Stats.list() now returns labeled, non-zero entries directly - a product's lore link and video never actually varied by knowledge level, only the data entry did (same two URLs repeated three times per product). Moved ExtraResources onto Product itself - data/products.ts is now a ProductCatalog built from named blueprints instead of a bare array of five-deep positional constructor calls - moved the three WelcomeSurvey storage repositories out of a UI component folder into domain/welcomeSurvey/infrastructure/ - shared test fixtures (productFixtures.ts) replace the ~90 lines of product construction duplicated across Cart.spec.ts and CartItem.spec.ts Cart went from 90 lines to 58, CartItem from 75 to 51: close to the 50-line rule, not exactly on it, and a first-class collection exists now where none did before. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014BcGPRc3sgUJYKihGRXh5g
This was referenced Sep 1, 2026
This was referenced Sep 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #6. This is the one the article is actually about.
Summary
CartItems: a first-class collection absorbing the find/map/filter/reduce that wasduplicated three times in
Cart, replacinggetItemsCopy()Cartnow takes item ids (increaseQuantity,decreaseQuantity,removeItem), so theUI no longer pulls a
Productback out of aCartItemjust to hand it back toCart.Added
remainingForFreeShipping(), theMoneyarithmetic that used to live in JSXCartItem.getProduct()(the source of that chain) and the deadgetPrice(),renamed the rest to
id()/name()/image()/quantity()CartItemontoQuantityitselfSkill's vocabulary andProduct's knowledge tiers were the same concept with twodifferent words (
intermediatevsadventurer), bridged by aProductCardLogicshim.Unified on one type, deleted the shim
GoldSilverCopperFormattersplit into conversion and presentation, both got the specsthey never had
Stats.asObject()dissolved the value object into a plain record the UI had tore-derive labels from, and it rendered
ManaBoost: 0rows.Stats.list()now returnslabeled, non-zero entries directly
data entry did. Moved that onto
Productitselfdata/products.tsis now aProductCatalogbuilt from named blueprints instead of abare array of five-deep positional constructor calls
domain/welcomeSurvey/infrastructure/two spec files
Cart went from 90 lines to 58, CartItem from 75 to 51: close to the 50-line rule, not
exactly on it.
Test plan
pnpm typecheckpnpm checkpnpm buildpnpm test, 14 files, 89 tests, all green🤖 Generated with Claude Code
https://claude.ai/code/session_014BcGPRc3sgUJYKihGRXh5g